import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  //import.meta.env 是 Vite 提供的内置环境变量对象
  //BASE_URL 表示项目部署的基础路径（根路径）.在vite.config.js中配置
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', redirect: '/weather' },
    { path: '/weather', component: () => import('../views/WeatherHome.vue') },
    { path: '/weather/:adcode', component: () => import('../views/CityDetail.vue') }
  ]
});

export default router; 